<!doctype html>
<html class="no-js">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport"
        content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>到空运</title>

  <!-- Set render engine for 360 browser -->
  <meta name="renderer" content="webkit">

  <!-- No Baidu Siteapp-->
  <meta http-equiv="Cache-Control" content="no-siteapp"/>

  <link rel="icon" type="image/png" href="assets/i/favicon.png">

  <!-- Add to homescreen for Chrome on Android -->
  <meta name="mobile-web-app-capable" content="yes">
  <link rel="icon" sizes="192x192" href="assets/i/app-icon72x72@2x.png">

  <!-- Add to homescreen for Safari on iOS -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
  <link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">

  <!-- Tile icon for Win8 (144x144 + tile color) -->
  <meta name="msapplication-TileImage" content="assets/i/app-icon72x72@2x.png">
  <meta name="msapplication-TileColor" content="#0e90d2">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <link rel="stylesheet" href="assets/css/amazeui.min.css">
   <link rel="stylesheet" href="assets/css/document.css">
<script src="assets/js/jquery.min.js"></script>
	<script src="assets/js/amazeui.js"></script>
	<script src="assets/js/memu.js"></script>
	<script src="assets/js/baiduTemplate.js"></script>
	<script src="assets/js/PublicFunction.js"></script>	




  <style type="text/css">
  
 
	  
	 
	
	

  </style>
</head>
<body>



<div id="parent" >
<div data-am-sticky id="header">
	<header data-am-widget="header" class="am-header am-header-default">
		<div class="am-header-left am-header-nav">
			<a  href="javascript:backA()" class="">
				
				<i class="am-header-icon am-icon-chevron-left"></i>
			</a>
		</div>
		<h1 class="am-header-title" style="font-size:14px;">
			到空运
		</h1>
		<div class="am-header-right am-header-nav">
			<a href="javascript:menu()" class="">
				<i class="am-header-icon am-icon-list-ul"></i>
			</a>
			
		</div>
	<!-- 遮罩-->
	<div class="am-modal am-modal-no-btn" tabindex="-1" id="memu-modal">
  
	</div>
	</header>
</div>
	<form id="subdata">
		<input type="hidden" name ="name" value ="到空运">
	</form>

	
  
                  
<div data-am-widget="list_news" class="am-list-news am-list-news-default">
	<div class="am-list-news-bd">
		<ul class="am-list" id="pending_put">
		<!--缩略图在标题左边-->
		
		<!-- <li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left" >
			<div class="am-u-sm-4 am-list-thumb">
				
					<img src="http://img5.douban.com/lpic/o636459.jpg" alt="我很囧，你保重....晒晒旅行中的那些囧！" />
				
			</div>
			<div class=" am-u-sm-7 am-list-main">
				<h3 class="am-list-item-hd">
					<a href="javascript:checkD();" class=""> 产品标题产品标题</a>
				</h3>
				<div class="am-list-item-text">所属类目：XXXXXX   </div>
				<div class="am-list-item-text">品规:100/箱&nbsp&nbsp价格:5$&nbsp&nbsp数量:500</div>
			
			</div>
			<div class=" am-u-sm-1 am-list-main" style="padding-top: 17px;" >
				<a href="#">
					<img src="assets/img/delete.png" width="12px"hetgit="12px" />
				</a>
			</div>
			
		</li> -->
		
		<!-- <li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left" >
			<div class="am-u-sm-4 am-list-thumb">
				
					<img src="http://img5.douban.com/lpic/o636459.jpg" alt="我很囧，你保重....晒晒旅行中的那些囧！" />
				
			</div>
			<div class=" am-u-sm-7 am-list-main">
				<h3 class="am-list-item-hd">
					<a href="javascript:checkD();" class=""> 产品标题产品标题</a>
				</h3>
				<div class="am-list-item-text">所属类目：XXXXXX   </div>
				<div class="am-list-item-text">品规:100/箱&nbsp&nbsp价格:5$&nbsp&nbsp数量:500</div>
			
			</div>
			<div class=" am-u-sm-1 am-list-main" style="padding-top: 17px;" >
				<a href="#">
					<img src="assets/img/delete.png" width="12px"hetgit="12px" />
				</a>
			</div>
		</li> -->
     
		</ul>
	</div>
</div>
		<div style="width: 70%;margin: auto auto;">
			<button type="button" class="am-btn am-btn-secondary am-btn-block" data-am-modal="{target: '#my-popup'}">添加</button>
 		</div>
</div>


 <div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default "id="">
  <ul class="am-navbar-nav am-cf am-avg-sm-4" style="width:100%; padding:0 0; ">
    <li>
      <a href="#" class="">
        
       <button type="button" class="am-btn am-btn-primary am-btn-block" onclick="submit()">提交</button>
      </a>
    </li>

  </ul>
</div>




<!-- 模态框 -->

<div class="am-popup" id="my-popup" title ="-1">
  <div class="am-popup-inner">
    <div class="am-popup-hd">
      <h4 class="am-popup-title"></h4>
      <span data-am-modal-close
            class="am-close">&times;</span>
    </div>
    <div class="am-popup-bd">
      	<div data-am-widget="list_news" class="am-list-news am-list-news-default" id = "div_puc">
      	<script type="text/javascript" id="puc_info">
			<div class="am-list-news-bd">
				<ul class="am-list" id="put">
				<!--缩略图在标题左边-->
				 <% for(var i=0;i<list.length;i++){ %> 
		 			<li class="am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left" id="p_<%=list[i].id%>" >
						<div class="am-u-sm-4 am-list-thumb">
							<img src="<%=server%><%=list[i].ProductImg%>" alt="我很囧，你保重....晒晒旅行中的那些囧！" />
						</div>
						<div class=" am-u-sm-7 am-list-main">
							<h3 class="am-list-item-hd">
								<a href="javascript:checkD('<%=list[i].id%>');" class=""> <%=list[i].name%></a>
							</h3>
							<div class="am-list-item-text">所属类目:<%=list[i].productType%> &nbsp&nbsp价格:$<span id ="P_<%=list[i].id%>"><%=list[i].Price%></span></div>
							<div class="am-list-item-text">品规:<%=list[i].specifications%>&nbsp&nbsp库存：<span id ="S_<%=list[i].id%>"><%=list[i].Stock%></span></div>
			
						</div>
						<div class=" am-u-sm-1 am-list-main" style="padding-top: 17px;" id="a_<%=list[i].id%>" >
							<a href="javascript:updateStock('<%=list[i].id%>');" style="font-size:30px; color: red;">
								+
							</a>
						</div>
			
					</li>
					
				

					<div class="am-modal am-modal-alert" tabindex="-1" id="my-alert<%=list[i].id%>">
					  <div class="am-modal-dialog">
					

					    <div class="am-modal-hd">输入推广价格库存</div>
					    <div class="am-modal-bd am-form-group"> 
					    <form  class="am-form">
					    			<span>输入库存</span>
					    		 <input id ="rawStock_<%=list[i].id%>" type="hidden" value="<%=list[i].Stock%>"  placeholder="保存产品原来的库存" />	
					    	 	 <input  type="number" class="input_<%=list[i].id%>" value ="<%=list[i].Stock%>"  id="doc-vld-age-2-1" placeholder="输入库存" min="0" max="10000000" required />		
					    	 		<span>输入价钱</span>
					    	 	 <input id ="rawPrice_<%=list[i].id%>" type="hidden" value="<%=list[i].Stock%>"  placeholder="保存产品原来的库存" />	
					    	 	 <input  type="number" class="Price_<%=list[i].id%>" value ="<%=list[i].Price%>"  id="doc-vld-age-2-1" placeholder="输入库存" min="0" max="10000000" required />		
					    	 	 
					     </form>
					    </div>
					    <div class="am-modal-footer">
					         <button class="am-btn am-btn-secondary" onclick="addp('<%=list[i].id%>')">提交</button>
					    </div>
					
					  </div>
					</div>
				<%}%>
				</ul>
			</div>
			</script>
		</div>			    	
    </div>
  </div>
</div>



<script type="text/javascript">
var sjson ="";
function init(w,h) {
	
	$('#my-popup').on('closed.modal.amui', function(){
		  $("#my-popup").attr("title","-1");
		});
	$('#my-popup').on('opened.modal.amui', function(){
		  $("#my-popup").attr("title","1");  
		});
	
	
	//生成menu
	generateMenu();
	 sjson = DucumentFunction.getProductbyUserid();
	
	 if(sjson!=null&&sjson.length>0){
		 var json = strToJson(sjson);
		 var serverpath= Public_method.getServerPath();
		 var data={
				server:serverpath+"upload/",
					list:json
				} 
			var bat=baidu.template;
			var title_img_html=bat('puc_info',data);
			//渲染
			document.getElementById('div_puc').innerHTML=title_img_html;  
	 }

	
	
  };
 
  /** 查看产品详情**/
  function checkD(id){
	  DucumentFunction.goDud(id);
  }
  
  /**修改库存**/
  function updateStock(id){
	  var $modal =$("#my-alert"+id);
	  $modal.modal();
	  
  }
  
  
  /** 添加产品**/
  function addp(id){
	  var $modal =$("#my-alert"+id);
	  $modal.modal();
	  $modal.modal('close');
	 
	  var html =  $("#p_"+id).html();
	  //先删除原有的节点
	  $("#pd"+id).remove(); 
	  //再添加
	  var li = "<li class=\"am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left\" id=\"pd"+id+"\" > </li>";
	  $("#pending_put").append(li);
	  //添加准备推广的产品信息
	  $("#pd"+id).html(html);
	  //删除已经添加的产品信息
	  $("#p_"+id).remove();
	  
	  //修改超连接
	  var pa = "<a href=\"javascript:deletep('"+id+"');\"><img src=\"assets/img/delete.png\" width=\"12px\"hetgit=\"12px\" /></a>";
	  $("#a_"+id).empty(); 
	  $("#a_"+id).html(pa);
	  //修改库存
	  var Stock = $(".input_"+id).val();
	  $("#S_"+id).html(Stock);
	  
	  //修改价格
	  var Price = $(".Price_"+id).val();
	  $("#P_"+id).html(Price);
	  
	  
	  //添加提交库存数据
	  var input =" <input id =\"data"+id+"\" name = \""+id+"\" type=\"hidden\" value=\""+Stock+"\"   />";
	  $("#subdata").append(input);
	  
		//添加提交价格数据
	   input =" <input id =\"pr"+id+"\" name = \"p"+id+"\" type=\"hidden\" value=\""+Price+"\"   />";
	  $("#subdata").append(input);
  }
  //删除要推广的产品
 function deletep(id){
	 
	 var html =  $("#pd"+id).html();
	  //先删除原有的节点
	  $("#p_"+id).remove(); 
	  //再添加
	  var li = "<li class=\"am-g am-list-item-desced am-list-item-thumbed am-list-item-thumb-left\" id=\"p_"+id+"\" > </li>";
	  $("#put").append(li);
	  //添加准备推广的产品信息
	  $("#p_"+id).html(html);
	  
	  
	  //删除已经添加的产品信息
	  $("#pd"+id).remove();
	  
	  //修改超连接
	
	  
	  var pa =" <a href=\"javascript:updateStock('"+id+"');\" style=\"font-size:30px; color: red;\">+</a>";
	  
	  $("#a_"+id).empty(); 
	  $("#a_"+id).html(pa);
	  //修改库存
	  var Stock = $("#rawStock_"+id).val();
	  $("#S_"+id).html(Stock);
	  
	  
	  //修改价格
	  var Price = $("#rawPrice_"+id).val();
	  $("#P_"+id).html(Price);
	  
	  //删除提交库存数据
	  $("#data"+id).remove();
	  
	  //删除提交价格数据
	  $("#pr"+id).remove();
	 
 }
//按返回键的操作
 function onBackPressed(){
 	var isopen = $("#my-popup").attr("title");

 	if(isopen == "1"){
 		  var $modal =$("#my-popup");
 		  $modal.modal('close');
 	}
 	else{
 		Public_method.finishActivity();
 	}
 	
 }
 
 function submit(){
	 var data =$("#subdata").serialize();
	 data = decodeURIComponent(data,true); 
	 MsgFunction.submitArrMSG(data);
 }
</script>
</body>
</html>
